package org.btik.light.mobile.platform.thread;


/***
 *基础循环线程
 *
 * */
public abstract class BaseLoopControllableThread extends Thread implements Controllable {
    private volatile boolean runFlag = true;

    @Override
    public void run() {
        while (runFlag) {
            if(!loop()){
                break;
            }
        }
    }

    protected abstract boolean loop();


    @Override
    public void shutdown(String msg) {
        runFlag = false;
    }
}
